package sun

import (
	"time"

	http_label_center "gobase/http_work_flow/label_center"
	"gobase/http_work_flow/label_center/ai/voice"

	"github.com/qida/gohp/timex"
)

const (
	StatusSunVoice删除工单记录 = -10

	StatusSunVoice新建工单记录  = 10
	StatusSunVoic可获取文件    = 20
	StatusSunVoice已生成文件记录 = 30
)

type ReqNotifySunVoice struct {
	Request struct {
		Action  string `json:"action"`
		Content struct {
			Device string `json:"DEVICE"`
			State  string `json:"STATE"`
			Dyjd   string `json:"DYJD"`
			Dywd   string `json:"DYWD"`
		} `json:"content"`
	} `json:"request"`
}

type ReqCreateSunVoice struct {
	TimeStart time.Time `json:"TimeStart"` //开始日期
}

type ReqCreateRecSunVoice struct {
	IdSunVoice int64 `json:"IdSunVoice"` //任务ID

	DeviceId    string `json:"DeviceId"`    //设备国标Id
	PlanNo      string `json:"PlanNo"`      //工单编号
	SegmentName string `json:"SegmentName"` //现场勘查

	TimeHookStart time.Time      `json:"TimeHookStart"` //挂载开始日期
	TimeHookEnd   timex.TimeNull `json:"TimeHookEnd"`   //挂载结束日期
}

// 请求 创建
type ReqSendSunVoice struct {
	IdSunVoice int64 `json:"IdSunVoice"` //任务ID

	Log http_label_center.Log `json:"Log,omitempty"` //追踪日志
}

type ReqRecognizeSunVoice struct {
	IdSunVoice int64 `json:"IdSunVoice"` //任务ID

	voice.ReqVoiceFile

	Log http_label_center.Log `json:"Log,omitempty"` //追踪日志
}

type ReqResultSunVoice struct {
	IdSunVoice int64 `json:"IdSunVoice"` //任务ID
}

// 请求 删除
type ReqDeleteSunVoice struct {
	IdSunVoice int64     `json:"IdSunVoice"` //任务ID
	TimeCreate time.Time `json:"TimeCreate"` //创建时间

	Log http_label_center.Log `json:"Log,omitempty"` //追踪日志
}

// 请求 搜索查询
type ReqSearchSunVoice struct {
	KeyWord string `json:"KeyWord"`

	IdRecSunVoice int64 `json:"IdRecSunVoice"` //ID
	IdSunVoice    int64 `json:"IdSunVoice"`    //任务ID

	PlanNo      string `json:"PlanNo"`      //工单编号
	DeviceId    string `json:"DeviceId"`    //设备国标Id
	SegmentName string `json:"SegmentName"` //现场勘查

	CityOrgName string `json:"CityOrgName"` //
	AreaOrgName string `json:"AreaOrgName"` //

	TimeMonth  time.Time `json:"TimeMonth"`  //月份过滤
	TimeCreate time.Time `json:"TimeCreate"` //创建时间

	IsHaveDelete bool `json:"IsHaveDelete"` //是否包含删除的工单

	Status      int8     `json:"Status,omitempty"`      //标签状态 正常:10 删除:-10
	Page        int64    `json:"Page"`                  //必填 指定返回页码号
	Limit       int64    `json:"Limit"`                 //必填 指定返回每页条数
	FieldOrders []string `json:"FieldOrders,omitempty"` //指定要排序的字段数组，默认升序，降序加前缀-，如 ["-Id", "Name"] 按Id降序Name升序排列

	Log http_label_center.Log `json:"Log,omitempty"` //追踪日志
}

// 请求 搜索查询
type ReqCountSunVoice struct {
	CityOrgName string    `json:"CityOrgName"`
	TimeCreate  time.Time `json:"TimeCreate"`
	TimeMonth   time.Time `json:"TimeMonth"` //月份过滤

	Log http_label_center.Log `json:"Log,omitempty"` //追踪日志
}

// 请求 搜索查询
type ReqSegmentSunVoice struct {
	PlanNo string `json:"PlanNo"` //工单Id

	Log http_label_center.Log `json:"Log,omitempty"` //追踪日志
}

type ReqListSunVoice struct {
	IdSunVoice int64 `json:"IdSunVoice"` //任务ID

	CityOrgName string    `json:"CityOrgName"`
	AreaOrgName string    `json:"AreaOrgName"`
	TimeCreate  time.Time `json:"TimeCreate"`
	TimeMonth   time.Time `json:"TimeMonth"` //月份过滤

	IsHaveDelete bool `json:"IsHaveDelete"` //是否包含删除的工单

	Log http_label_center.Log `json:"Log,omitempty"` //追踪日志
}

// 响应 单一对象
type RespSunVoice struct {
	IdSunVoice int64 `json:"IdSunVoice"` //任务ID

	PlanNo      string `json:"PlanNo"`      //工单Id
	DeviceId    string `json:"DeviceId"`    //设备编码(国标Id)
	SegmentName string `json:"SegmentName"` //现场勘查",

	Status     int8   `json:"Status"`
	StatusText string `json:"StatusText"`

	// TimeHookStart time.Time      `json:"TimeHookStart"` //挂载开始时间
	// TimeHookEnd   timex.TimeNull `json:"TimeHookEnd"`   //挂载结束时间

	TimeStart time.Time      `json:"TimeStart"` //环节开始时间
	TimeEnd   timex.TimeNull `json:"TimeEnd"`   //环节结束时间

	AreaCode     string `json:"AreaCode"`     //3740401",
	AreaOrgName  string `json:"AreaOrgName"`  //薛城供电中心",
	CityCode     string `json:"CityCode"`     //37404",
	CityOrgName  string `json:"CityOrgName"`  //枣庄供电公司",
	CustomerName string `json:"CustomerName"` //山东国元新材料有限公司",
	// StreamUrl    string `json:"StreamUrl"`    //"rtsp://10.141.204.235:21988/DevAor=37030000001320000057"

	TimeCreate time.Time `json:"TimeCreate"` //创建时间
}

// 响应 查询列表
type RespSunVoices struct {
	Total     int64          `json:"Total"`     //返回列表的总条数
	SunVoices []RespSunVoice `json:"SunVoices"` //返回列表对象
}

// 响应 单一对象
type AreaPlanNo struct {
	NameArea string
	PlanNo   string `json:"PlanNo"` //工单Id
}
type RespAreaPlanNo struct {
	NameCity string
	PlanNo   []string `json:"PlanNo"` //工单Id
}

// 响应 查询列表
type RespListSunVoices struct {
	AreaPlanNos []RespAreaPlanNo `json:"AreaPlanNos"` //返回列表对象
}

type CountCityPlanNo struct {
	NameCity    string
	CountPlanNo int64
}

type CountCityTask struct {
	NameCity  string
	CountTask int64
}

type CountAreaPlanNo struct {
	NameCity    string
	NameArea    string
	CountPlanNo int64
}

type RespCountSunVoices struct {
	CountCityPlanNo []CountCityPlanNo `json:"CountCityPlanNo"`
	CountCityTask   []CountCityTask   `json:"CountCityTask"`
	CountAreaPlanNo []CountAreaPlanNo `json:"CountAreaPlanNo"`
}
